package com.courierplease.converter.controller;

import com.alibaba.fastjson.JSONArray;
import com.courierplease.converter.req.QuoteReq;
import com.courierplease.converter.service.IQuoteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created By shenhaitao on 2021/3/29
 */
@RestController
@RequestMapping("/convert")
@Api(value = "报价转换",tags = "报价转换[Quotation conversion]")
public class QuoteController {

    @Autowired
    private IQuoteService quoteService;

    @ApiOperation(value = "获取报价")
    @PostMapping(value = "/quote")
    public String convertQuote(@RequestBody QuoteReq quoteReq) {
        return new JSONArray().toJSONString(quoteService.postForQuote(quoteReq));
    }
}
